import {createApp} from 'vue'
// import './style.css'  //这行自动生成的需要去掉
import App from './App.vue'
import router from '@/router/index.ts'    //需要npm install vue-router@4 IDEA会提示安装
import ElementPlus from 'element-plus'  //引入elementPlus  需要 npm install element-plus --save
import 'element-plus/dist/index.css'    //引入elementPlus样式
import * as ElementPlusIconsVue from '@element-plus/icons-vue'  //引入elementPlusIcons  需要 npm install @element-plus/icons-vue
import zhCn from 'element-plus/es/locale/lang/zh-cn' //element plus组件国际化
// import {createPinia} from "pinia";  //需要npm install pinia
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'  // npm install pinia-plugin-persist   安装pinia持久化插件防止刷新页面后选项卡数据丢失
import myConfirm from "@/utils/myConfirm.ts";
import {permission} from "@/derective/permission.ts";//按钮权限指令
// import pinia from "@/piniaInstance.ts";
// import hasParm from "@/derective/hsaPerm.ts";//按钮权限指令2
import './permission.ts'//路由权限
import * as echarts from 'echarts'
import {createPinia} from "pinia";
//引入echarts  npm install echarts

const pinia = createPinia();//实例化pinia
pinia.use(piniaPluginPersistedstate)
const app = createApp(App);
app.directive('permission', permission)//使用自定义按钮权限指令
app.use(router)
app.use(ElementPlus, {
    locale: zhCn
})
app.use(pinia)
//注册elementPlusIcons
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
//全局挂载
app.config.globalProperties.$myConfirm = myConfirm//自定义确认框
// app.config.globalProperties.$hsaPerm = hasParm//按钮权限指令2
app.config.globalProperties.$echarts = echarts //echarts

app.mount('#app')



